Note that <tt>d3dx9_25.dll</tt> is a system DLL — it is intended to be installed only by the DirectX Setup
installer into the <tt>Windows\System32</tt> directory.
</p>
<p>
To enable the FX driver, go to <em>Options > Preferences > Display</em>. DirectX support, Direct3D support,
and the FX driver should all be enabled. The filename of an <tt>.fx</tt> file must be supplied to use; if a full
path is not given, the file is assumed to come from VirtualDub's program directory.
</p>
<p>
For detailed documentation on the <tt>.fx</tt> file format, consult the Microsoft DirectX 9.0c SDK.
</p>
<h2>Available surfaces and textures</h2>
<p>
A total of three textures and one surface are available for use:
</p>
<ul>
<li>The output render target, sized to the output frame.</li>
<li>The source texture, which holds the current video frame.</li>
<li>The previous source texture, which holds the last video frame.</li>
<li>Two temporary render target textures, which are at least as large as the desktop.</li>
</ul>
<p>
Declaring variables with specific names will automatically cause them to be bound to the textures:
</p>
<blockquote><pre>
texture vd_srctexture;
texture vd_prevsrctexture; // new - 1.7.1
texture vd_prevsrc2texture; // new - 1.7.3
texture vd_temptexture;
texture vd_temptexture2;
</pre></blockquote>
<p>
The output render target is at least <tt>X8R8G8B8</tt>. The temporary render targets are of format <tt>A8R8G8B8</tt>;
in addition, they are guaranteed to be powers of two as long as the device does not support full
non-power-of-two textures; in particular, the restrictions of the <tt>NONPOW2CONDITIONAL</tt> caps bit do
not have to be followed when using them.
</p>
<p>
The <tt>vd_srctexture</tt> variable can take a single annotation:
</p>
<dl>
<dt>bool vd_forceframeupload = <i>force_flag</i>; // new - 1.7.1</dt>
<dd>
If <tt>true</tt>, this annotation changes the behavior of image upload when operating in field
mode. Normally, when field display mode is enabled, the even and odd fields of the source texture
are alternately updated; this effectively applies weave deinterlacing to the input. When <tt>vd_forceframeupload</tt>
is set to <tt>true</tt>, both fields are uploaded on the first field of every frame.
</dd>
</dl>
<h2>Technique selection and execution</h2>
<p>
A technique must be named either <em>point</em>, <em>bilinear</em>, or <em>bicubic</em> for it to be used.
Each of these names maps to one of the filtering modes in the right-click context menu of the video pane;
this allows up to three techniques to be selected from the <tt>.fx</tt> file. If a technique is not available,
a nearby available technique from the three is used instead.
</p>
<p>
When a video frame is displayed, VirtualDub sequentially executes each of the passes in the file. If interlaced
display mode is enabled, the technique is executed twice per frame, after each field is updated. This allows
field-savvy shaders to do adaptive deinterlacing on the video input.
</p>
<p>
Each pass is executed with a quad (four vertex rectangular mesh). The components of the vertex declaration accessible
from the vertex shader are (all are two component):
</p>
<ul>
<li><em>POSITION:</em> The four corners of the output viewport. These are already corrected for the Direct3D half-pixel offset so that they exactly encompass the screen.</li>
<li><em>TEXCOORD0:</em> The four corners of the source image subrect within the source texture.</li>
<li><em>TEXCOORD1:</em> Full-texture analogs of the first texcoord set — (0,0), (0,1), (1,0), and (1,1).</li>
</ul>
<p>
Thus, passing POSITION and TEXCOORD0 through is enough to do a straight blit using point or bilinear sampling.
</p>
<h2>Pass annotations</h2>
<p>
Passes within a rendering technique can be annotated to instruct VirtualDub to take certain actions prior to